package com.xinchuang.controller;

import javax.annotation.Resource;
import java.text.SimpleDateFormat;
import java.util.List;
import java.util.ArrayList;

import javax.servlet.http.HttpServletRequest;
import java.util.*;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
import com.xinchuang.utils.CheckUtil;
import com.xinchuang.comment.R;
import com.xinchuang.comment.ResultCode;
import com.google.gson.Gson;

import java.text.SimpleDateFormat;

import com.xinchuang.utils.DateUtils;
import org.springframework.web.multipart.MultipartFile;
import org.apache.commons.lang3.StringUtils;
import com.xinchuang.service.MoldSelectionsModService;

/**
 * MoldSelectionsModController
 *
 * @date 2023-09-14
 */
@RestController
@RequestMapping("/moldSelectionsMod")
@Api(value = "选模表模块", tags = "选模表模块")
public class MoldSelectionsModController {
    private static SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

    @Resource
    private MoldSelectionsModService moldSelectionsModService;

    /**
     * 获取选模列表接口接口  函数名称getMoldSelectionList  功能描述:
     *
     * @param jsonObject 中文名:通用实体类
     * @return 返回参数{}
     */
    @PostMapping("/getMoldSelectionList")
    @ApiOperation("获取选模列表接口")
    public R getMoldSelectionList(@RequestBody JSONObject jsonObject) {
//        String methodName = Thread.currentThread().getStackTrace()[1].getMethodName();
//        Set<String> sSet = new HashSet<>();
//        String result = jsonLoop(jsonObject, "", methodName + "SC", sSet);
//        result = result + getMoldSelectionListACS(sSet);
//        if (result.length() > 0) {
//            return R.fail("入参：" + result);
//        } else {
            // 调用业务层代码
            String r = moldSelectionsModService.getMoldSelectionList(jsonObject);
//            Set<String> aSet = new HashSet<>();
//            JSONObject o = JSON.parseObject(r);
//            if (o == null) {
//                o = new JSONObject();
//            }
//            result = jsonLoop(o.get("data"), "", methodName + "AC", aSet);
//            result = result + getMoldSelectionListACB(aSet);
//            if (result.length() > 0) {
//                return R.fail("出参：" + result);
//            }
            return JSON.parseObject(r, R.class);
//        }
    }

    /**
     * 导入选模表xlxs文件接口接口  函数名称imoprtFile  功能描述:
     *
     * @param file 中文名:excel文件
     * @return 返回参数{}
     */
    @PostMapping("/imoprtFile")
    @ApiOperation("导入选模表xlxs文件接口")
    public R imoprtFile(@RequestParam(value = "file", required = false) MultipartFile file, HttpServletRequest request) {
//        String fileresult = "";
//        fileresult = CheckUtil.checkFile(file, "excel文件", true);
//        if (StringUtils.isNotEmpty(fileresult)) {
//            return R.fail(fileresult);
//        }
//        String methodName = Thread.currentThread().getStackTrace()[1].getMethodName();
//        String result = "";
//        if (result.length() > 0) {
//            return R.fail("入参：" + result);
//        } else {
            // 调用业务层代码
            String r = moldSelectionsModService.imoprtFile(file,request);
//            Set<String> aSet = new HashSet<>();
//            JSONObject o = JSON.parseObject(r);
//            if (o == null) {
//                o = new JSONObject();
//            }
//            result = jsonLoop(o.get("data"), "", methodName + "AC", aSet);
//            result = result + imoprtFileACB(aSet);
//            if (result.length() > 0) {
//                return R.fail("出参：" + result);
//            }
            return JSON.parseObject(r, R.class);
//        }
    }

    /**
     * 批量删除选模表接口  函数名称deleteMoldSelections  功能描述:批量删除选模表
     *
     * @param jsonObject 中文名:通用实体类
     * @return 返回参数{}
     */
    @PostMapping("/deleteMoldSelections")
    @ApiOperation("批量删除选模表")
    public R deleteMoldSelections(@RequestBody JSONObject jsonObject) {
//        String methodName = Thread.currentThread().getStackTrace()[1].getMethodName();
//        Set<String> sSet = new HashSet<>();
//        String result = jsonLoop(jsonObject, "", methodName + "SC", sSet);
//        result = result + deleteMoldSelectionsACS(sSet);
//        if (result.length() > 0) {
//            return R.fail("入参：" + result);
//        } else {
            // 调用业务层代码
            String r = moldSelectionsModService.deleteMoldSelections(jsonObject);
//            Set<String> aSet = new HashSet<>();
//            JSONObject o = JSON.parseObject(r);
//            if (o == null) {
//                o = new JSONObject();
//            }
//            result = jsonLoop(o.get("data"), "", methodName + "AC", aSet);
//            result = result + deleteMoldSelectionsACB(aSet);
//            if (result.length() > 0) {
//                return R.fail("出参：" + result);
//            }
            return JSON.parseObject(r, R.class);
//        }
    }

    /**
     * 保存选模表接口  函数名称saveMoldSelection  功能描述:保存选模表
     *
     * @param jsonObject 中文名:通用实体类
     * @return 返回参数{}
     */
    @PostMapping("/saveMoldSelection")
    @ApiOperation("保存选模表")
    public R saveMoldSelection(@RequestBody JSONObject jsonObject) {
//        String methodName = Thread.currentThread().getStackTrace()[1].getMethodName();
//        Set<String> sSet = new HashSet<>();
//        String result = jsonLoop(jsonObject, "", methodName + "SC", sSet);
//        result = result + saveMoldSelectionACS(sSet);
//        if (result.length() > 0) {
//            return R.fail("入参：" + result);
//        } else {
            // 调用业务层代码
            String r = moldSelectionsModService.saveMoldSelection(jsonObject);
//            Set<String> aSet = new HashSet<>();
//            JSONObject o = JSON.parseObject(r);
//            if (o == null) {
//                o = new JSONObject();
//            }
//            result = jsonLoop(o.get("data"), "", methodName + "AC", aSet);
//            result = result + saveMoldSelectionACB(aSet);
//            if (result.length() > 0) {
//                return R.fail("出参：" + result);
//            }
            return JSON.parseObject(r, R.class);
//        }
    }

    /**
     * 获取选模表详情接口接口  函数名称getMoldSelectionDetail  功能描述:
     *
     * @param jsonObject 中文名:通用实体类
     * @return 返回参数{}
     */
    @PostMapping("/getMoldSelectionDetail")
    @ApiOperation("获取选模表详情接口")
    public R getMoldSelectionDetail(@RequestBody JSONObject jsonObject) {
//        String methodName = Thread.currentThread().getStackTrace()[1].getMethodName();
//        Set<String> sSet = new HashSet<>();
//        String result = jsonLoop(jsonObject, "", methodName + "SC", sSet);
//        result = result + getMoldSelectionDetailACS(sSet);
//        if (result.length() > 0) {
//            return R.fail("入参：" + result);
//        } else {
            // 调用业务层代码
            String r = moldSelectionsModService.getMoldSelectionDetail(jsonObject);
//            Set<String> aSet = new HashSet<>();
//            JSONObject o = JSON.parseObject(r);
//            if (o == null) {
//                o = new JSONObject();
//            }
//            result = jsonLoop(o.get("data"), "", methodName + "AC", aSet);
//            result = result + getMoldSelectionDetailACB(aSet);
//            if (result.length() > 0) {
//                return R.fail("出参：" + result);
//            }
            return JSON.parseObject(r, R.class);
//        }
    }

    /**
     * 提交选模表接口接口  函数名称postToCheck  功能描述:导入的excel虽然是已经审批过的，但是也允许修改。修改后需要重新审批
     *
     * @param jsonObject 中文名:通用实体类
     * @return 返回参数{}
     */
    @PostMapping("/postToCheck")
    @ApiOperation("提交选模表接口")
    public R postToCheck(@RequestBody JSONObject jsonObject) {
//        String methodName = Thread.currentThread().getStackTrace()[1].getMethodName();
//        Set<String> sSet = new HashSet<>();
//        String result = jsonLoop(jsonObject, "", methodName + "SC", sSet);
//        result = result + postToCheckACS(sSet);
//        if (result.length() > 0) {
//            return R.fail("入参：" + result);
//        } else {
            // 调用业务层代码
            String r = moldSelectionsModService.postToCheck(jsonObject);
//            Set<String> aSet = new HashSet<>();
//            JSONObject o = JSON.parseObject(r);
//            if (o == null) {
//                o = new JSONObject();
//            }
//            result = jsonLoop(o.get("data"), "", methodName + "AC", aSet);
//            result = result + postToCheckACB(aSet);
//            if (result.length() > 0) {
//                return R.fail("出参：" + result);
//            }
            return JSON.parseObject(r, R.class);
//        }
    }

    /**
     * 删除分表接口接口  函数名称deleteSubTableById  功能描述:
     *
     * @param jsonObject 中文名:通用实体类
     * @return 返回参数{}
     */
    @PostMapping("/deleteSubTableById")
    @ApiOperation("删除分表接口")
    public R deleteSubTableById(@RequestBody JSONObject jsonObject) {
//        String methodName = Thread.currentThread().getStackTrace()[1].getMethodName();
//        Set<String> sSet = new HashSet<>();
//        String result = jsonLoop(jsonObject, "", methodName + "SC", sSet);
//        result = result + deleteSubTableByIdACS(sSet);
//        if (result.length() > 0) {
//            return R.fail("入参：" + result);
//        } else {
            // 调用业务层代码
            String r = moldSelectionsModService.deleteSubTableById(jsonObject);
//            Set<String> aSet = new HashSet<>();
//            JSONObject o = JSON.parseObject(r);
//            if (o == null) {
//                o = new JSONObject();
//            }
//            result = jsonLoop(o.get("data"), "", methodName + "AC", aSet);
//            result = result + deleteSubTableByIdACB(aSet);
//            if (result.length() > 0) {
//                return R.fail("出参：" + result);
//            }
            return JSON.parseObject(r, R.class);
//        }
    }


    public static String jsonLoop(Object object, String result, String methodName, Set<String> set) {
        Object v = null;
        if (object instanceof JSONArray || object instanceof ArrayList) {
            JSONArray jsonArray = new JSONArray();
            if (object instanceof ArrayList) {
                jsonArray = JSONArray.parseArray(JSON.toJSONString(object));
            } else {
                jsonArray = (JSONArray) object;
            }
            for (int i = 0; i < jsonArray.size(); i++) {
                result = jsonLoop(jsonArray.get(i), result, methodName, set);
                if (StringUtils.isNotEmpty(result)) {
                    return result;
                }
            }
        }
        if (object instanceof JSONObject) {
            JSONObject jsonObject = (JSONObject) object;
            for (Map.Entry<String, Object> entry : jsonObject.entrySet()) {
                Object o = entry.getValue();
                if (o instanceof JSONArray || o instanceof ArrayList) {
                    result += selectCheckMathod(entry.getKey(), entry.getValue(), methodName, set);
                    result = jsonLoop(o, result, methodName, set);
                    if (StringUtils.isNotEmpty(result)) {
                        return result;
                    }
                } else if (o instanceof JSONObject) {
                    result = jsonLoop(o, result, methodName, set);
                    if (StringUtils.isNotEmpty(result)) {
                        return result;
                    }
                } else {
//                   FIXME: 未知类型
                }
                v = entry.getValue();
                result += selectCheckMathod(entry.getKey(), v, methodName, set);
            }
        }
        return result;
    }

    private static String selectCheckMathod(String key, Object value, String methodName, Set<String> set) {
        String result = "";
        if ("getMoldSelectionListSC".equals(methodName)) {
            result = getMoldSelectionListSC(key, value, set);
        }
        if ("getMoldSelectionListAC".equals(methodName)) {
            result = getMoldSelectionListAC(key, value, set);
        }
        if ("imoprtFileSC".equals(methodName)) {
            result = imoprtFileSC(key, value, set);
        }
        if ("imoprtFileAC".equals(methodName)) {
            result = imoprtFileAC(key, value, set);
        }
        if ("deleteMoldSelectionsSC".equals(methodName)) {
            result = deleteMoldSelectionsSC(key, value, set);
        }
        if ("deleteMoldSelectionsAC".equals(methodName)) {
            result = deleteMoldSelectionsAC(key, value, set);
        }
        if ("saveMoldSelectionSC".equals(methodName)) {
            result = saveMoldSelectionSC(key, value, set);
        }
        if ("saveMoldSelectionAC".equals(methodName)) {
            result = saveMoldSelectionAC(key, value, set);
        }
        if ("getMoldSelectionDetailSC".equals(methodName)) {
            result = getMoldSelectionDetailSC(key, value, set);
        }
        if ("getMoldSelectionDetailAC".equals(methodName)) {
            result = getMoldSelectionDetailAC(key, value, set);
        }
        if ("postToCheckSC".equals(methodName)) {
            result = postToCheckSC(key, value, set);
        }
        if ("postToCheckAC".equals(methodName)) {
            result = postToCheckAC(key, value, set);
        }
        if ("deleteSubTableByIdSC".equals(methodName)) {
            result = deleteSubTableByIdSC(key, value, set);
        }
        if ("deleteSubTableByIdAC".equals(methodName)) {
            result = deleteSubTableByIdAC(key, value, set);
        }
        return result;
    }


    private static String getMoldSelectionListSC(String key, Object value, Set<String> set) {
        String result = "";
        Boolean isNull = false;
        if ("projectName".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "项目名称", isNull, 0, 255);
        }
        if ("partsStorageBinId".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "零件厂Id（量产地）", isNull, 0, 255);
        }
        if ("mainEnginePlantId".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "主机厂Id (客户)", isNull, 0, 255);
        }
        if ("pageNum".equals(key)) {
            isNull = true;
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "页码", isNull, 0, 255);
        }
        if ("param1".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "备用参数1", isNull, 0, 255);
        }
        if (isNull) {
            set.add(key);
        }
        return result;
    }

    private static String getMoldSelectionListAC(String key, Object value, Set<String> set) {
        String result = "";
        Boolean isNull = false;
        if ("code".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkBigDecimal(value == null ? "" : value.toString(), "状态码", isNull, "0", "100000");
        }
        if ("success".equals(key)) {
            // 判断参数类型: String  num boolean datetime
        }
        if ("msg".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "返回消息", isNull, 0, 255);
        }
        if ("totalNum".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "总条数", isNull, 0, 255);
        }
        if ("dataList".equals(key)) {
            result += CheckUtil.checkJSONArray(JSONArray.parseArray(JSON.toJSONString(value)), "列表数据", isNull);
        }
        if ("moldSelectionId".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "选模表Id", isNull, 0, 255);
        }
        if ("projectName".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "项目名称", isNull, 0, 255);
        }
        if ("partsStorageBinId".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "零件厂Id（量产地）", isNull, 0, 255);
        }
        if ("partsStorageBinName".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "零件厂名称（量产地名称）", isNull, 0, 255);
        }
        if ("mainEnginePlantId".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "客户 （主机厂Id）", isNull, 0, 255);
        }
        if ("mainEnginePlantName".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "主机厂名称", isNull, 0, 255);
        }
        if ("setNumOfMold".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "模具套数", isNull, 0, 255);
        }
        if ("customerManager".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "客户项目经理", isNull, 0, 255);
        }
        if ("date".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "日期", isNull, 0, 255);
        }
        if ("createBy".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "创建人", isNull, 0, 255);
        }
        if ("addtime".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "创建时间", isNull, 0, 255);
        }
        if ("status".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "提交状态", isNull, 0, 255);
        }
        if (isNull) {
            set.add(key);
        }
        return result;
    }

    private static String imoprtFileSC(String key, Object value, Set<String> set) {
        String result = "";
        Boolean isNull = false;
        if ("file".equals(key)) {
            isNull = true;
            // 判断参数类型: String  num boolean datetime
        }
        if (isNull) {
            set.add(key);
        }
        return result;
    }

    private static String imoprtFileAC(String key, Object value, Set<String> set) {
        String result = "";
        Boolean isNull = false;
        if ("code".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkBigDecimal(value == null ? "" : value.toString(), "状态码", isNull, "0", "100000");
        }
        if ("msg".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "返回消息", isNull, 0, 255);
        }
        if ("success".equals(key)) {
            // 判断参数类型: String  num boolean datetime
        }
        if (isNull) {
            set.add(key);
        }
        return result;
    }

    private static String deleteMoldSelectionsSC(String key, Object value, Set<String> set) {
        String result = "";
        Boolean isNull = false;
        if ("moldSelectionIds".equals(key)) {
            isNull = true;
            // 判断参数类型: String  num
            result += CheckUtil.checkJSONArray(JSONArray.parseArray(JSON.toJSONString(value)), "选模表ids", isNull, 1000, 2, 1, 0, 255);

        }
        if (isNull) {
            set.add(key);
        }
        return result;
    }

    private static String deleteMoldSelectionsAC(String key, Object value, Set<String> set) {
        String result = "";
        Boolean isNull = false;
        if ("code".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkBigDecimal(value == null ? "" : value.toString(), "状态码", isNull, "0", "100000");
        }
        if ("msg".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "返回消息", isNull, 0, 255);
        }
        if ("success".equals(key)) {
            // 判断参数类型: String  num boolean datetime
        }
        if (isNull) {
            set.add(key);
        }
        return result;
    }

    private static String saveMoldSelectionSC(String key, Object value, Set<String> set) {
        String result = "";
        Boolean isNull = false;
        if ("param2".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "备用参数2", isNull, 0, 255);
        }
        if ("param1".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "备用参数1", isNull, 0, 255);
        }
        if ("moldSelectionId".equals(key)) {
            isNull = true;
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "选模表Id", isNull, 0, 255);
        }
        if ("projectName".equals(key)) {
            isNull = true;
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "项目名称", isNull, 0, 255);
        }
        if ("partsStorageBinId".equals(key)) {
            isNull = true;
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "零件厂Id（量产地）", isNull, 0, 999999999);
        }
        if ("customerId".equals(key)) {
            isNull = true;
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "客户Id", isNull, 0, 99999999);
        }
        if ("setNumOfMold".equals(key)) {
            isNull = true;
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkBigDecimal(value == null ? "" : value.toString(), "模具套数", isNull, "0", "9999999");
        }
        if ("customerManager".equals(key)) {
            isNull = true;
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "客户项目经理", isNull, 0, 255);
        }
        if ("date".equals(key)) {
            isNull = true;
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "日期", isNull, 0, 255);
        }
        if ("checkoutName".equals(key)) {
            isNull = true;
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "审批人", isNull, 0, 255);
        }
        if ("approver".equals(key)) {
            isNull = true;
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "批准人", isNull, 0, 255);
        }
        if ("dataList".equals(key)) {
            result += CheckUtil.checkJSONArray(JSONArray.parseArray(JSON.toJSONString(value)), "数据列表", isNull);
        }
        if ("lengthOfProduct".equals(key)) {
            isNull = true;
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkBigDecimal(value == null ? "" : value.toString(), "产品尺寸-长", isNull, "0", "999999999");
        }
        if ("nameOfProduct".equals(key)) {
            isNull = true;
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "产品名称", isNull, 0, 255);
        }
        if ("imageOfProduct".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "产品图片", isNull, 0, 255);
        }
        if ("codeOfProduct".equals(key)) {
            isNull = true;
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "产品代号", isNull, 0, 255);
        }
        if ("isSupply".equals(key)) {
            isNull = true;
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "是否承制", isNull, 0, 255);
        }
        if ("moldSelecttionType".equals(key)) {
            isNull = true;
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "选模模具类型", isNull, 0, 255);
        }
        if ("weightOfMold".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkBigDecimal(value == null ? "" : value.toString(), "模具重量T", isNull, "0", "99999999");
        }
        if ("heightOfMold".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkBigDecimal(value == null ? "" : value.toString(), "模具尺寸-高", isNull, "0", "999999999");
        }
        if ("lengthOfMold".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkBigDecimal(value == null ? "" : value.toString(), "模具尺寸-长", isNull, "0", "999999999");
        }
        if ("widthOfMold".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkBigDecimal(value == null ? "" : value.toString(), "模具尺寸-宽", isNull, "0", "999999999");
        }
        if ("plannedT0Time".equals(key)) {
            isNull = true;
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "T0时间", isNull, 0, 255);
        }
        if ("ejectionOrresetMode".equals(key)) {
            isNull = true;
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "顶出/复位方式", isNull, 0, 255);
        }
        if ("pickUpWay".equals(key)) {
            isNull = true;
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "取件方式", isNull, 0, 255);
        }
        if ("moldingCycle".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "成型周期S", isNull, 0, 255);
        }
        if ("sizeOfMachine".equals(key)) {
            isNull = true;
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "机台大小", isNull, 0, 99999999);
        }
        if ("isChangeColor".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "产品是否换色", isNull, 0, 255);
        }
        if ("pourSystem".equals(key)) {
            isNull = true;
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "浇注系统", isNull, 0, 255);
        }
        if ("lifetimeOfMold".equals(key)) {
            isNull = true;
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "模具寿命（万模）（与模具绑定）", isNull, 0, 255);
        }
        if ("perCavitiesOfMold".equals(key)) {
            isNull = true;
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "每模腔数 （与模具绑定）", isNull, 0, 255);
        }
        if ("materialOfCore".equals(key)) {
            isNull = true;
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "型芯材质 （与模具绑定）", isNull, 0, 255);
        }
        if ("materialOfCavity".equals(key)) {
            isNull = true;
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "型腔材质 （与模具绑定）", isNull, 0, 255);
        }
        if ("customerMoldId".equals(key)) {
            isNull = true;
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "模具编号（客户）", isNull, 0, 255);
        }
        if ("surfaceRequire".equals(key)) {
            isNull = true;
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "外观要求", isNull, 0, 255);
        }
        if ("materials".equals(key)) {
            isNull = true;
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "材料信息(与模具绑定的模具材料)", isNull, 0, 255);
        }
        if ("heightOfProduct".equals(key)) {
            isNull = true;
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkBigDecimal(value == null ? "" : value.toString(), "产品尺寸-高", isNull, "0", "999999999");
        }
        if ("widthOfProduct".equals(key)) {
            isNull = true;
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkBigDecimal(value == null ? "" : value.toString(), "产品尺寸-宽", isNull, "0", "999999999");
        }
        if ("subTableId".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "分表Id", isNull, 0, 255);
        }
        if ("subParam1".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "分表备用参数1", isNull, 0, 255);
        }
        if ("subParam2".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "分表备用参数2", isNull, 0, 255);
        }
        if ("partsStorageBinName".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "零件厂名称（量产地名称）", isNull, 0, 255);
        }
        if ("mainEnginePlantName".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "主机厂名称", isNull, 0, 255);
        }
        if (isNull) {
            set.add(key);
        }
        return result;
    }

    private static String saveMoldSelectionAC(String key, Object value, Set<String> set) {
        String result = "";
        Boolean isNull = false;
        if ("code".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkBigDecimal(value == null ? "" : value.toString(), "状态码", isNull, "0", "100000");
        }
        if ("msg".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "返回消息", isNull, 0, 255);
        }
        if ("success".equals(key)) {
            // 判断参数类型: String  num boolean datetime
        }
        if (isNull) {
            set.add(key);
        }
        return result;
    }

    private static String getMoldSelectionDetailSC(String key, Object value, Set<String> set) {
        String result = "";
        Boolean isNull = false;
        if ("moldSelectionId".equals(key)) {
            isNull = true;
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "选模表Id", isNull, 0, 999999999);
        }
        if (isNull) {
            set.add(key);
        }
        return result;
    }

    private static String getMoldSelectionDetailAC(String key, Object value, Set<String> set) {
        String result = "";
        Boolean isNull = false;
        if ("code".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkBigDecimal(value == null ? "" : value.toString(), "状态码", isNull, "0", "100000");
        }
        if ("msg".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "返回消息", isNull, 0, 255);
        }
        if ("success".equals(key)) {
            // 判断参数类型: String  num boolean datetime
        }
        if ("moldSelectionId".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "选模表Id", isNull, 0, 255);
        }
        if ("projectName".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "项目名称", isNull, 0, 255);
        }
        if ("partsStorageBinId".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "零件厂Id（量产地）", isNull, 0, 255);
        }
        if ("customerId".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "客户id(主机厂Id)", isNull, 0, 999999999);
        }
        if ("setNumOfMold".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "模具套数", isNull, 0, 255);
        }
        if ("customerManager".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "客户项目经理", isNull, 0, 255);
        }
        if ("date".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "日期", isNull, 0, 255);
        }
        if ("checkoutName".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "审批人", isNull, 0, 255);
        }
        if ("approver".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "批准人", isNull, 0, 255);
        }
        if ("dataList".equals(key)) {
            result += CheckUtil.checkJSONArray(JSONArray.parseArray(JSON.toJSONString(value)), "数据列表", isNull);
        }
        if ("nameOfProduct".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "产品名称", isNull, 0, 255);
        }
        if ("codeOfProduct".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "产品代号", isNull, 0, 255);
        }
        if ("imageOfProduct".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "产品图片", isNull, 0, 255);
        }
        if ("lengthOfProduct".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkBigDecimal(value == null ? "" : value.toString(), "产品尺寸-长", isNull, "0", "999999999");
        }
        if ("widthOfProduct".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkBigDecimal(value == null ? "" : value.toString(), "产品尺寸-宽", isNull, "0", "999999999");
        }
        if ("heightOfProduct".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkBigDecimal(value == null ? "" : value.toString(), "产品尺寸-高", isNull, "0", "999999999");
        }
        if ("materials".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "材料信息(与模具绑定的模具材料)", isNull, 0, 255);
        }
        if ("surfaceRequire".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "外观要求", isNull, 0, 255);
        }
        if ("customerMoldId".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "模具编号(客户)", isNull, 0, 999999999);
        }
        if ("materialOfCavity".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "型腔材质 （与模具绑定）", isNull, 0, 255);
        }
        if ("materialOfCore".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "型芯材质 （与模具绑定）", isNull, 0, 255);
        }
        if ("perCavitiesOfMold".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "每模腔数 （与模具绑定）", isNull, 0, 255);
        }
        if ("lifetimeOfMold".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "模具寿命（万模）（与模具绑定）", isNull, 0, 255);
        }
        if ("pourSystem".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "浇注系统", isNull, 0, 255);
        }
        if ("isChangeColor".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "产品是否换色", isNull, 0, 255);
        }
        if ("sizeOfMachine".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "机台大小", isNull, 0, 255);
        }
        if ("moldingCycle".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "成型周期S", isNull, 0, 255);
        }
        if ("pickUpWay".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "取件方式", isNull, 0, 255);
        }
        if ("ejectionOrresetMode".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "顶出/复位方式", isNull, 0, 255);
        }
        if ("plannedT0Time".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "T0时间", isNull, 0, 255);
        }
        if ("lengthOfMold".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkBigDecimal(value == null ? "" : value.toString(), "模具尺寸-长", isNull, "0", "999999999");
        }
        if ("widthOfMold".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkBigDecimal(value == null ? "" : value.toString(), "模具尺寸-宽", isNull, "0", "999999999");
        }
        if ("heightOfMold".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkBigDecimal(value == null ? "" : value.toString(), "模具尺寸-高", isNull, "0", "999999999");
        }
        if ("weightOfMold".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkBigDecimal(value == null ? "" : value.toString(), "模具重量T", isNull, "0", "999999999");
        }
        if ("moldSelecttionType".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "选模模具类型", isNull, 0, 999999999);
        }
        if ("isSupply".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "是否承制", isNull, 0, 255);
        }
        if ("status".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkBigDecimal(value == null ? "" : value.toString(), "提交状态", isNull, "0", "3");
        }
        if ("subTableId".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "分表Id", isNull, 0, 999999999);
        }
        if ("subParam1".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "分表备用参数1", isNull, 0, 999999999);
        }
        if ("param2".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "备用参数2", isNull, 0, 255);
        }
        if ("param1".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "备用参数1", isNull, 0, 255);
        }
        if ("subParam2".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "分表备用参数2", isNull, 0, 999999999);
        }
        if ("partsStorageBinName".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "零件厂名称（量产地名称）", isNull, 0, 255);
        }
        if ("mainEnginePlantName".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "主机厂名称", isNull, 0, 255);
        }
        if (isNull) {
            set.add(key);
        }
        return result;
    }

    private static String postToCheckSC(String key, Object value, Set<String> set) {
        String result = "";
        Boolean isNull = false;
        if ("moldSelectionId".equals(key)) {
            isNull = true;
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "选模表Id", isNull, 0, 255);
        }
        if (isNull) {
            set.add(key);
        }
        return result;
    }

    private static String postToCheckAC(String key, Object value, Set<String> set) {
        String result = "";
        Boolean isNull = false;
        if ("code".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkBigDecimal(value == null ? "" : value.toString(), "状态码", isNull, "0", "100000");
        }
        if ("msg".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "返回消息", isNull, 0, 255);
        }
        if ("success".equals(key)) {
            // 判断参数类型: String  num boolean datetime
        }
        if ("status".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "提交状态", isNull, 0, 255);
        }
        if (isNull) {
            set.add(key);
        }
        return result;
    }

    private static String deleteSubTableByIdSC(String key, Object value, Set<String> set) {
        String result = "";
        Boolean isNull = false;
        if ("subTableId".equals(key)) {
            isNull = true;
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "分表Id", isNull, 0, 255);
        }
        if ("moldSelectionId".equals(key)) {
            isNull = true;
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "选模表Id", isNull, 0, 255);
        }
        if (isNull) {
            set.add(key);
        }
        return result;
    }

    private static String deleteSubTableByIdAC(String key, Object value, Set<String> set) {
        String result = "";
        Boolean isNull = false;
        if ("code".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkBigDecimal(value == null ? "" : value.toString(), "状态码", isNull, "0", "100000");
        }
        if ("msg".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "返回消息", isNull, 0, 255);
        }
        if ("success".equals(key)) {
            // 判断参数类型: String  num boolean datetime
        }
        if (isNull) {
            set.add(key);
        }
        return result;
    }

    private static String getMoldSelectionListACS(Set<String> set) {
        List<String> list = new ArrayList<>();
        list.add("pageNum");
        if (set.size() == list.size()) {
            return "";
        }
        return getCollectionDifferentValue(list, set, "入参");
    }

    private static String getMoldSelectionListACB(Set<String> set) {
        List<String> list = new ArrayList<>();
        if (set.size() == list.size()) {
            return "";
        }
        return getCollectionDifferentValue(list, set, "出参");
    }

    private static String imoprtFileACS(Set<String> set) {
        List<String> list = new ArrayList<>();
        if (set.size() == list.size()) {
            return "";
        }
        return getCollectionDifferentValue(list, set, "入参");
    }

    private static String imoprtFileACB(Set<String> set) {
        List<String> list = new ArrayList<>();
        if (set.size() == list.size()) {
            return "";
        }
        return getCollectionDifferentValue(list, set, "出参");
    }

    private static String deleteMoldSelectionsACS(Set<String> set) {
        List<String> list = new ArrayList<>();
        list.add("moldSelectionIds");
        if (set.size() == list.size()) {
            return "";
        }
        return getCollectionDifferentValue(list, set, "入参");
    }

    private static String deleteMoldSelectionsACB(Set<String> set) {
        List<String> list = new ArrayList<>();
        if (set.size() == list.size()) {
            return "";
        }
        return getCollectionDifferentValue(list, set, "出参");
    }

    private static String saveMoldSelectionACS(Set<String> set) {
        List<String> list = new ArrayList<>();
        list.add("moldSelectionId");
        list.add("date");
        list.add("sizeOfMachine");
        list.add("perCavitiesOfMold");
        list.add("ejectionOrresetMode");
        list.add("plannedT0Time");
        list.add("lifetimeOfMold");
        list.add("materialOfCore");
        list.add("pourSystem");
        list.add("heightOfProduct");
        list.add("checkoutName");
        list.add("setNumOfMold");
        list.add("nameOfProduct");
        list.add("surfaceRequire");
        list.add("approver");
        list.add("customerManager");
        list.add("moldSelecttionType");
        list.add("materialOfCavity");
        list.add("customerMoldId");
        list.add("codeOfProduct");
        list.add("materials");
        list.add("isSupply");
        list.add("lengthOfProduct");
        list.add("projectName");
        list.add("widthOfProduct");
        list.add("pickUpWay");
        if (set.size() == list.size()) {
            return "";
        }
        return getCollectionDifferentValue(list, set, "入参");
    }

    private static String saveMoldSelectionACB(Set<String> set) {
        List<String> list = new ArrayList<>();
        if (set.size() == list.size()) {
            return "";
        }
        return getCollectionDifferentValue(list, set, "出参");
    }

    private static String getMoldSelectionDetailACS(Set<String> set) {
        List<String> list = new ArrayList<>();
        list.add("moldSelectionId");
        if (set.size() == list.size()) {
            return "";
        }
        return getCollectionDifferentValue(list, set, "入参");
    }

    private static String getMoldSelectionDetailACB(Set<String> set) {
        List<String> list = new ArrayList<>();
        if (set.size() == list.size()) {
            return "";
        }
        return getCollectionDifferentValue(list, set, "出参");
    }

    private static String postToCheckACS(Set<String> set) {
        List<String> list = new ArrayList<>();
        list.add("moldSelectionId");
        if (set.size() == list.size()) {
            return "";
        }
        return getCollectionDifferentValue(list, set, "入参");
    }

    private static String postToCheckACB(Set<String> set) {
        List<String> list = new ArrayList<>();
        if (set.size() == list.size()) {
            return "";
        }
        return getCollectionDifferentValue(list, set, "出参");
    }

    private static String deleteSubTableByIdACS(Set<String> set) {
        List<String> list = new ArrayList<>();
        list.add("moldSelectionId");
        list.add("subTableId");
        if (set.size() == list.size()) {
            return "";
        }
        return getCollectionDifferentValue(list, set, "入参");
    }

    private static String deleteSubTableByIdACB(Set<String> set) {
        List<String> list = new ArrayList<>();
        if (set.size() == list.size()) {
            return "";
        }
        return getCollectionDifferentValue(list, set, "出参");
    }

    /**
     * 获取集合中的不同值
     *
     * @param list
     * @param set
     * @return
     */
    private static String getCollectionDifferentValue(List<String> list, Set<String> set, String flag) {
        String result = "";
        for (String str : list) {
            if (!set.contains(str)) {
                result += str + ",";
            }
        }
        if (StringUtils.isNotEmpty(result)) {
            result = StringUtils.strip(result, ",");
            result = "---" + flag + ":" + result + "为必填参数";
        }
        return result;
    }
}
